const { defineConfig } = require('@vue/cli-service')
const { VantResolver } = require('@vant/auto-import-resolver');
const ComponentsPlugin = require('unplugin-vue-components/webpack');
module.exports = defineConfig({
  transpileDependencies: true,
  configureWebpack: {
    plugins: [
      ComponentsPlugin.default({ resolvers: [VantResolver()] }), //当 unplugin-vue-components 版本大于等于 0.26.0
    ],
  },
   //配置反向代理
   devServer: {
    proxy: {
      '/api': {
        target: 'https://apis.netstart.cn/douguo',  // 需要跨域的目标url
        changeOrigin: true,
        pathRewrite: {
          '^/api': '',  // 将请求的路径重写为 /api 后为空
        },
      },
    },
  }
})
